package com.gxar.quick.ar.server.base.common.enums;

import java.util.Arrays;
import java.util.Optional;

/**
 * @author linsy
 * @version 1.0
 * @created 2023/11/15 14:17
 */
public enum ComboConfigItemEnum {

    SLOT(1, "Slot", "场景数量"),
    IMPRESSIONS(2, "Impressions", "识别次数"),
    WATERMARK(3, "Watermark", "水印"),
    IDENTIFY(4, "Identify", "识别图"),
    VIDEO(5, "Video", "视频上传"),
    UNITY3D_MODEL(6, "3DModel", "3D模型"),
    ;

    private final Integer code;
    private final String item;
    private final String name;

    ComboConfigItemEnum(Integer code, String item, String name) {
        this.code = code;
        this.item = item;
        this.name = name;
    }

    /**
     * 根据item查询
     *
     * @param item item
     * @return 响应
     */
    public static ComboConfigItemEnum getByItem(String item) {
        Optional<ComboConfigItemEnum> comboItemEnum = Arrays.stream(ComboConfigItemEnum.values()).filter(e -> e.getItem().equals(item)).findFirst();
        return comboItemEnum.orElse(null);
    }

    /**
     * 根据code查询
     *
     * @param code code
     * @return 套餐配置item
     */
    public static ComboConfigItemEnum getByCode(Integer code) {
        Optional<ComboConfigItemEnum> comboItemEnum = Arrays.stream(ComboConfigItemEnum.values()).filter(e -> e.getCode().equals(code)).findFirst();
        return comboItemEnum.orElse(null);
    }

    public Integer getCode() {
        return code;
    }

    public String getItem() {
        return item;
    }

    public String getName() {
        return name;
    }
}
